#include "Camera.h"

#define TRANSLATEWEIGHT 0.1f

Vector3f up;
Vector3f look;
Vector3f rright;
Vector3f Camera::position;

float yaw, pitch;

GLvoid Camera::Initialize() {
	up = Vector3f(0.0f, 1.0f, 0.0f);
	look = Vector3f(0.0f, 0.0f, -1.0f);
	rright = Vector3f(1.0f, 0.0f, 0.0f);
	yaw = 0.0f;
	pitch = 0.0f;
}

void Camera::Yaw(float angle) {
	yaw += angle;
}

void Camera::Pitch(float angle) {
	pitch += angle;
}

void Camera::ForwardBackward(float distance) {
	float amount = (TRANSLATEWEIGHT * distance);
	position += (look * amount);
}

void Camera::Lateral(float distance) {
	float amount = (TRANSLATEWEIGHT * distance);
	position += (rright * amount);
}

void Camera::Vertical(float distance) {
	float amount = (TRANSLATEWEIGHT * distance);
	position += (up * amount);
}

GLvoid Camera::TransformCamera() {
	glTranslatef(position.x, position.y, position.z);
	glRotatef(yaw, 0.0f, 1.0f, 0.0f);
	glRotatef(pitch, 1.0f, 0.0f, 0.0f);
}
